<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <title>转账确认</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  <link rel="stylesheet" href="../static/framework/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="../static/framework/reset.css">
  <link rel="stylesheet" href="../static/css/footer.css">
  <link rel="stylesheet" href="../static/css/transferAssure.css">
  <link rel="stylesheet" href="../static/bootstrap-5.3.0-dist/css/bootstrap.min.css">
  <script src="../static/bootstrap-5.3.0-dist/js/bootstrap.bundle.min.js"></script>
  <link href="../static/layui-v2.9.1/layui/css/layui.css" rel="stylesheet">
  <script src="../static/layui-v2.9.1/layui/layui.js"></script>

  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f0f0f0;
    }

    .footer {
      position: fixed;
      left: 0;
      bottom: 0;
      width: 100%;
      text-align: center;
      background-color: #f1f1f1;
      box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    }

    .transfer {
      list-style-type: none;
      padding: 0;
      background-color: #fff;
      border: 1px solid #ccc;
      border-radius: 5px;
      margin: 0 auto;
    }

    .transfer li {
      padding: 10px;
      border-bottom: 1px solid #eee;
    }

    .transfer li:last-child {
      border-bottom: none;
    }

    .transfer input[type="text"],
    .transfer input[type="password"] {
      width: calc(100% - 20px);
      padding: 8px;
      margin: 5px 0;
      border: 1px solid #ccc;
      border-radius: 3px;
      box-sizing: border-box;
    }

    .password {
      margin-top: 10px;
    }

    .transfer input[type="submit"] {
      background-color: #4CAF50;
      color: white;
      border: none;
      padding: 10px 20px;
      text-align: center;
      text-decoration: none;
      display: inline-block;
      font-size: 16px;
      border-radius: 3px;
      cursor: pointer;
      margin-top: 10px;
      width: 100%;
      box-sizing: border-box;
    }

    .transfer input[type="submit"]:hover {
      background-color: #45a049;
    }
  </style>
</head>

<body>
<div class="wrapper">
  <!-- 标题区 -->
  <header>
    <i class="fa fa-angle-left fa-2x" onclick="location.href='/address'"></i>
    <p>转账确认</p>
    <p></p>
  </header>
  <br>
  <!-- 信息确认区 -->
  <form action="/company/pay" method="post">
    <ul class="transfer">
      <input type="hidden" id="recName" name="recName" th:value="${session.company.getCompanyName()}">
      <li>
        收款方账号：<br>
        <input type="text" name="recardId" th:value="${session.company.companyCount}">
      </li>

      <li>
        缴费金额：<br>
        <input type="text" name="money" placeholder="请输入支付金额">
      </li>

      <li>
        选择支付卡：
        <select class="form-select" name="cardId" style="width: calc(100% - 20px);">
          <option id="cardId" name="cardId" th:each="card : ${session.cards}" th:if="${card.statusId} == 1" th:value="${card.idNumber}" th:text="${card.idNumber} + '(余额:' + ${card.balance} + ')'" >选择卡号</option>
        </select>
      </li>

      <li>
        支付密码：<br>
        <input type="password" placeholder="支付密码" class="password" name="password">
      </li>

      <li>
        <div class="button_sub">
          <button type="submit">确认缴费</button>
        </div>
      </li>

      <li style="color: red" th:text="${session.msg}"></li>

    </ul>
  </form>


  <footer class="footer">
    <div>
      <button type="button" class="layui-btn">
        <i class="layui-icon layui-icon-left"></i>
      </button>
      <button type="button" class="layui-btn">
        <i class="layui-icon layui-icon-right"></i>
      </button>
    </div>
  </footer>
</div>
<script>
  const back = document.querySelector(' .footer button:first-child')
  const forword = back.nextElementSibling
  back.addEventListener('click', function () {
    //history.back()
    history.go(-1)
  })

  forword.addEventListener('click', function () {
    //history.forward()
    history.go(1)
  })
  const urlParams = new URLSearchParams(window.location.search);
  const h3 = urlParams.get('account'); // 获取参数名为 account 的值
  const p = urlParams.get('name'); // 获取参数名为 name 的值

  document.querySelector('.transfer li:nth-child(1) p').textContent = h3
  document.querySelector('.transfer li:nth-child(2) p').textContent = p


</script>
</body>

</html>